﻿/*
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2009
' by DotNetNuke Corporation
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
' DEALINGS IN THE SOFTWARE.
*/

using WatiN.Core;
using DotNetNuke.Tests.UI.WatiN.Common;

namespace DotNetNuke.Tests.UI.WatiN.Common.WatiNObjects
{
    public class AdminSkinPage : WatiNBase
    {
        #region Constructors

        public AdminSkinPage(WatiNBase watinBase) : base(watinBase.IEInstance, watinBase.SiteUrl, watinBase.DBName) { }

        public AdminSkinPage(IE ieInstance, string siteUrl, string dbName) : base(ieInstance, siteUrl, dbName) { }

        #endregion

        #region Public Properties

        #region Links
        public Link DeleteSkinPackageLink
        {
            get { return IEInstance.Link(Find.ByTitle("Delete Skin Package")); }
        }
        public Link FirstApplyButton
        {
            get { return IEInstance.Links.Filter(Find.ByText("Apply"))[0]; }
        }
        public Link FirstDeleteContainerButton
        {
            get { return ContainersTable.Links.Filter(Find.ByText("Delete"))[0]; }
        }
        public Link FirstDeleteSkinButton
        {
            get { return SkinsTable.Links.Filter(Find.ByText("Delete"))[0]; }
        }
        public Link FirstPreviewButton
        {
            get { return IEInstance.Links.Filter(Find.ByText("Preview"))[0]; }
        }       
        public Link ParseSkinPackageLink
        {
            get { return IEInstance.Link(Find.ByTitle("Parse Skin Package")); }
        }
        public Link RestoreDefaultSkin
        {
            get { return IEInstance.Link(Find.ByTitle("Restore Default Skin")); }
        }
        public Link UpdateLink
        {
            get { return IEInstance.Link(Find.ByTitle("Update")); }
        }
        #endregion

        #region SelectLists
        public SelectList ContainerSelectList
        {
            get { return IEInstance.SelectList(Find.ById(s => s.EndsWith("editskins_cboContainers"))); }
        }
        public SelectList SkinSelectList
        {
            get { return IEInstance.SelectList(Find.ById(s => s.EndsWith("editskins_cboSkins"))); }
        }
        public SelectList SkinDesignerSkinSelectList
        {
            get { return IEInstance.SelectList(Find.ById(s => s.EndsWith("Attributes_cboSkins"))); }
        }
        public SelectList SkinDesignerContainerSelectList
        {
            get { return IEInstance.SelectList(Find.ById(s => s.EndsWith("Attributes_cboContainers"))); }
        }
        public SelectList FileSelectList
        {
            get { return IEInstance.SelectList(Find.ById(s => s.EndsWith("Attributes_cboFiles"))); }
        }
        public SelectList TokenSelectList
        {
            get { return IEInstance.SelectList(Find.ById(s => s.EndsWith("Attributes_cboTokens"))); }
        }
        public SelectList SettingSelectList
        {
            get { return IEInstance.SelectList(Find.ById(s => s.EndsWith("Attributes_cboSettings"))); }
        }
        #endregion

        #region CheckBoxes
        public CheckBox AdminCheckBox
        {
            get { return IEInstance.CheckBox(Find.ById(s => s.EndsWith("editskins_chkAdmin"))); }
        }
        public CheckBox PortalCheckBox
        {
            get { return IEInstance.CheckBox(Find.ById(s => s.EndsWith("editskins_chkPortal"))); }
        }
        public CheckBox HostSkinsCheckBox
        {
            get { return IEInstance.CheckBox(Find.ById(s => s.EndsWith("editskins_chkHost"))); }
        }
        public CheckBox SiteSkinsCheckBox
        {
            get { return IEInstance.CheckBox(Find.ById(s => s.EndsWith("editskins_chkSite"))); }
        }
        #endregion
        
        #region Tables
        public Table ContainersTable
        {
            get { return IEInstance.Table(Find.ById(s => s.EndsWith("editskins_tblContainers"))); }
        }

        public Table SkinsTable
        {
            get { return IEInstance.Table(Find.ById(s => s.EndsWith("editskins_tblSkins"))); }
        }
        #endregion

        #region Spans
        public Span FirstContainerNameSpan
        {
            get { return ContainersTable.OwnTableRows[0].OwnTableCells[0].Span(Find.Any); }
        }

        public Span FirstSkinNameSpan
        {
            get { return SkinsTable.OwnTableRows[0].OwnTableCells[0].Span(Find.Any);}
        }
        #endregion

        #region Divs
        public Div SkinDesignerDiv
        {
            get { return IEInstance.Div(Find.ById("dnnEditSkins")); }
        }
        #endregion

        #region TextFields
        public TextField ValueTextField
        {
            get { return IEInstance.TextField(Find.ById(s => s.EndsWith("Attributes_txtValue"))); }
        }
        #endregion

        #endregion

        #region Public Methods



        #endregion
    }
}